
package jp.moisture.othello.board;

public class Stone implements Cloneable {
    public static final int BLACK = 0;
    public static final int WHITE = 1;
    int mColor = WHITE;
    boolean mImmutable;
    boolean mPotentialImmutable;

    public Stone(int color) {
        mColor = color;
    }

    public Stone(Stone stone) {
        mColor = stone.mColor;
        mImmutable = stone.mImmutable;
        mPotentialImmutable = stone.mPotentialImmutable;
    }

    @Override
    public String toString() {
        if (mImmutable) {
            return mColor == BLACK ? "■" : "□";
        } else if (mPotentialImmutable) {
            return mColor == BLACK ? "◆" : "◇";
        } else {
            return toString(mColor);
        }
    }

    public static String toString(int color) {
        return color == BLACK ? "●" : "○";
    }

    public final void turn() {
        mColor = mColor == BLACK ? WHITE : BLACK;
    }

    public static final int otherColor(int color) {
        return color == BLACK ? WHITE : BLACK;
    }

}
